<?php
$T->loadTpl("./html/".$template."/".$qname.".html");
$T->SetTpl('cssjs','html/cssjs.inc'); 
$T->SetTpl('jsmodel','html/jsmodel.inc');     
  
$p=isset($_GET["p"])?$_GET["p"]:"1";
$offset = ($p-1)*15;
$uid=$_SESSION['uid'];
$list =$T->db->query("select A.*,B.truename from sys_announce A left join sys_member B on B.id=A.sender  order by A.time desc limit {$offset},15")->fetchAll(PDO::FETCH_ASSOC);
$str_html = '';
foreach ($list as $k => $val) {
    $content =  strip_tags($val['content']);
    $str_html.='<tr>
                    <td>
                        <input type="checkbox" name="checkbox" lay-skin="primary" value="'.$val["id"].'"/>
                    </td>
                    <td>'.$val["id"].'</td>
                    <td>'.$val["truename"].'</td>
                    <td class="ellipsis">'.$content.'</td>
                    <td>'.$val["time"].'</td>
                    <td>    
                        <button class="layui-btn layui-btn-mini layui-btn-normal ajax"  data-opt="view"  data-id="'.$val["id"].'">
                            <i class="iconfont">&#xe605;</i>查看
                        </button>
                        <button class="layui-btn layui-btn-mini layui-btn-danger ajax"  data-opt="del"  data-id="'.$val["id"].'">
                            <i class="iconfont">&#xe626;</i>删除
                        </button>
                    </td>
                </tr>';
}
$rc=$T->db->query("select count(*) from sys_announce")->fetchColumn(0);
if($p<1)$p=1;
$page=getPageHtml_bt($rc,15,$p,"&t=announce_sys");
$page=mb_convert_encoding($page, 'utf-8', 'utf-8');

$nowid = $T->db->query("select id from sys_announce where locate('".$_SESSION['school']."',acceptsch)>0 order by time desc limit 1")->fetchColumn(0);
if($nowid)$T->Set("nowid",$nowid);
$T->Set("page",$page);
$T->Set("str_html",$str_html);

$T->Set("template",$template);        
$T->clearNaN();       
$T->clearNoN();
$T->display(); 